package com.asset.action;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.Inet4Address;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.net.URLEncoder;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.asset.pojo.User;
import org.apache.poi.ss.usermodel.Workbook;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.asset.pojo.Asset;
import com.asset.pojo.Status;
import com.asset.utils.CsvUtil;
import com.asset.utils.POIExcelAssetBean;
import com.asset.utils.POIExcelBaseBean;
import com.asset.utils.POIExcelUtils;
import com.asset.utils.QRCodeUtil;
import com.asset.webBean.AssetWeb;



public class AssetAction extends BaseAction{
	
	private String text;
	private OutputStream output;
	private File file;
	private String fileName;
	private String temp;
	private List<Asset> assetLists;
	private List<Asset> pdLists;
	private List<Asset> unPdLists;
	private AssetWeb assetWeb;
	private int pdStatus;
	private Asset asset;
	private int id;
	private String ids;
	private String operaRes; // 1 操作成功，2 操作失败
	private String url = "" ;
	private List<String> QRcodeUrl;
	private String [] checkedIds;
	private static int pigeNum =15;
	//总页数
	private int pageSizeALL;
	//当前页
	private int pageSizeCurr =1;
	//所有记录数目
	private int pageNumAll;
	//显示导航数组
	private List<Integer> pagingArr;
	//查询总数量;
	private int querySum;
	//查询的用户名
	private String queryUserName;
	private Long userId;
	private List<User> userList;
	private JSONArray jsonArray;
	private JSONObject jsonObject;
	private Integer start;
	private Integer length;
	private Integer draw;
	private Short equipGenre;
	private Short status;
	private Map<String,Object> dataMap;
	{
	    Enumeration allNetInterfaces;
        try{
            allNetInterfaces = NetworkInterface.getNetworkInterfaces();
            InetAddress ip = null;
            while (allNetInterfaces.hasMoreElements()){
                NetworkInterface netInterface = (NetworkInterface) allNetInterfaces.nextElement();
//                System.out.println(netInterface.getName());
                Enumeration addresses = netInterface.getInetAddresses();
                while (addresses.hasMoreElements()){
                    ip = (InetAddress) addresses.nextElement();
                    if (ip != null && ip instanceof Inet4Address)
                    {
                        url = "http://"+ip.getHostAddress() + ":8080/getAssetMessage.action";
                    } 
                }
            }
        }catch(SocketException e){
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
	}
	private JSONArray passArray(List<Asset> asl){
	    JSONArray ja = new JSONArray();
	    SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd");
	    SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
	    for(Asset as : asl){
	        JSONObject jo = new JSONObject();
	        jo.put("id", as.getId());
	        jo.put("equipIdentifier", as.getEquipIdentifier());
	        if(as.getEquipGenre() != null){
	            jo.put("equipGenre", Asset.EquipGenre.getName(as.getEquipGenre()));
	        }
	        jo.put("equipModel", as.getEquipModel());
	        jo.put("usePerson", as.getUsePerson());
	        jo.put("useDepart", as.getUseDepart());
	        if(as.getUsePosition() != null){
	            jo.put("usePosition", as.getUsePosition());
	        }
	        if(as.getStatus() != null){
	            jo.put("status", Asset.Status.getName(as.getStatus()));
	        }
	        if(as.getSource() != null){
	            jo.put("source", Asset.Source.getName(as.getSource()));
	        }
	        jo.put("assetAllocation", as.getAssetAllocation());
	        if(as.getBuyTime() != null){
	            jo.put("buyTime", sdf1.format(as.getBuyTime()));
	        }
	        if(as.getUsedTime() != null){
	            jo.put("usedTime", sdf1.format(as.getUsedTime()));
	        }
	        if(as.getModifyTime() != null){
	            jo.put("lastTime", sdf2.format(as.getModifyTime()));
	        }
	        jo.put("remarks", as.getRemarks());
	        ja.add(jo);
	    }
	    return ja;
	}
	private AssetWeb passAssetWeb(Asset a){
	    AssetWeb aw = new AssetWeb();
	    SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd");
        SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        aw.setId(a.getId());
        aw.setEquipIdentifier(a.getEquipIdentifier());
        if(a.getEquipGenre() != null){
            aw.setEquipGenre(Asset.EquipGenre.getName(a.getEquipGenre()));
        }
        aw.setEquipModel(a.getEquipModel());
        aw.setUsePerson(a.getUsePerson());
        aw.setUseDepart(a.getUseDepart());
        if(a.getUsePosition() != null){
            aw.setUsePosition(a.getUsePosition());
        }
        if(a.getStatus() != null){
            aw.setStatus(Asset.Status.getName(a.getStatus()));
        }
        if(a.getSource() != null){
            aw.setSource(Asset.Source.getName(a.getSource()));
        }
        aw.setAssetAllocation(a.getAssetAllocation());
        if(a.getBuyTime() != null){
            aw.setBuyTime(sdf1.format(a.getBuyTime()));
        }
        if(a.getUsedTime() != null){
            aw.setUsedTime(sdf1.format(a.getUsedTime()));
        }
        if(a.getModifyTime() != null){
            aw.setLastTime(sdf2.format(a.getModifyTime()));
        }
        aw.setRemarks(a.getRemarks());
        return aw;
	}
	
	public String editPdAsset(){
		Status status=new Status();
		status.setPdStatus(pdStatus);
		if(pdStatus == 1){
			statusService.updateSataus(status);
		}else{
			statusService.updateSataus(status);
			assetService.exitIfPd(2);
		}
		return SUCCESS;
	}
	public String toPdNotAsset(){
		Status s=statusService.getStatus();
		pdLists=new ArrayList<Asset>();
		unPdLists=new ArrayList<Asset>();
		pdStatus=s.getPdStatus();
		if(pdStatus == 1){//如果开启盘点
			//unPdLists=assetService.listUnPd();
			pageNumAll =unPdLists.size();
		}
		return SUCCESS;
	}
   public String listPdNoAssetData(){
        Status s=statusService.getStatus();
        pdLists=new ArrayList<Asset>();
        unPdLists=new ArrayList<Asset>();
        pdStatus=s.getPdStatus();
        pageNumAll=0;
        if(pdStatus == 1){//如果开启盘点
            try{
                unPdLists=assetService.listUnPd(temp, start, length);
            }catch(Exception e){
                // TODO: handle exception
                e.printStackTrace();
                throw e;
            }
            pageNumAll =assetService.listUnPd(temp, null, null).size();
        }
        dataMap = new HashMap<String, Object>();
        dataMap.put("draw", draw);
        dataMap.put("recordsTotal", pageNumAll);
        dataMap.put("data", passArray(unPdLists));
        dataMap.put("recordsFiltered", pageNumAll);
        return "success";
    }

	public String toPdAlreadyAsset(){
		Status s=statusService.getStatus();
		pdLists=new ArrayList<Asset>();
		unPdLists=new ArrayList<Asset>();
		pdStatus=s.getPdStatus();
		if(pdStatus == 1){//如果开启盘点
			pdLists=assetService.listPd(null, null, null);
			pageNumAll=pdLists.size();
		}
		return SUCCESS;
	}
	public String listPdAssetData(){
        Status s=statusService.getStatus();
        pdLists=new ArrayList<Asset>();
        pdStatus=s.getPdStatus();
        pageNumAll=0;
        if(pdStatus == 1){//如果开启盘点
            try{
                pdLists=assetService.listPd(null, start, length);
            }catch(Exception e){
                // TODO: handle exception
                e.printStackTrace();
                throw e;
            }
            pageNumAll =assetService.listPd(null, null, null).size();
        }
        dataMap = new HashMap<String, Object>();
        dataMap.put("draw", draw);
        dataMap.put("recordsTotal", pageNumAll);
        dataMap.put("data", passArray(pdLists));
        dataMap.put("recordsFiltered", pageNumAll);
        return "success";
    }

	public String addByFile(){
		try {
			if(!fileName.endsWith("csv")){
				getSession().setAttribute("tip", "失败，目前仅支持csv格式");
			}else{
				InputStream fs=new FileInputStream(file);
				InputStreamReader fsr=new InputStreamReader(fs,"GBK");
				List<List<String>> lls =CsvUtil.readCSVFile(fsr);
//				System.out.println(lls);
				//注意点：csv 顺序：资产编号，设备类别，设备型号，使用人员，使用部门，使用地点，使用状况，设备来源，资产配置，购买时间，开始使用时间，备注
				//		时间格式："yyyy-MM-dd".
				
				for(int i = 0; i<lls.size(); i++){
					Asset a = new Asset();
					if(i == 0){
					    
					}else{
					    List<String> ls = lls.get(i);
					    if(ls.get(0)  !=  null && !ls.get(0).equals("")){
	                        a.setEquipIdentifier(ls.get(0));
	                    }
	                    if(ls.get(1) != null && !ls.get(1).equals("")){
	                        a.setEquipGenre(Asset.EquipGenre.getValue(ls.get(1))); 
	                    }
	                    if(ls.get(2) != null && !ls.get(2).equals("")){
	                        a.setEquipModel(ls.get(2));
	                    }
	                    if(ls.get(3) != null && !ls.get(3).equals("")){
	                        a.setUsePerson(ls.get(3));
	                    }
	                    if(ls.get(4) != null && !ls.get(4).equals("")){
	                        a.setUseDepart(ls.get(4));
	                    }
	                    if(ls.get(5) != null && !ls.get(5).equals("")){
	                        a.setUsePosition(ls.get(5));
	                    }
	                    if(ls.get(6) != null && !ls.get(6).equals("")){
	                        a.setStatus(Asset.Status.getValue(ls.get(6)));
	                    }
	                    if(ls.get(7) != null && !ls.get(7).equals("")){
	                        a.setSource(Asset.Source.getValue(ls.get(7)));
	                    }
	                    if(ls.get(8) != null && !ls.get(8).equals("")){
	                        a.setAssetAllocation(ls.get(8));
	                    }
	                    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
	                    if(ls.get(9) != null && !ls.get(9).equals("")){
	                        String temp=ls.get(9).replaceAll("/", "-");
	                        Date buyTime=sdf.parse(temp);
	                        a.setBuyTime(buyTime);
	                    }
	                    if(ls.get(10) != null && !ls.get(10).equals("")){
	                        temp=ls.get(10).replaceAll("/", "-");
	                        Date usedTime=sdf.parse(temp);
	                        a.setUsedTime(usedTime);
	                    }
	                    if(ls.get(11) != null && !ls.get(11).equals("")){
	                        a.setRemarks(ls.get(11));
	                    }
	                    a.setModifyTime(new Date());
	                    assetService.insert(a);
					}
				}
				getSession().setAttribute("tip", "录入成功");
			}
		
		} catch (Exception e) {
			// TODO: handle exception
			e.printStackTrace();
			return "sysError";
			//return "sysError";
		}
		return SUCCESS;
	}
	
	
	public String getAssetMessage(){
		try {
			asset=assetService.getAssetByPrivateKey(id);
			if(null == asset){
				asset=new Asset();
				tip="数据为空，可能已经被删除";
			}else{
				Status s=statusService.getStatus();
				pdStatus=s.getPdStatus();
				if(pdStatus == 1){
					asset.setIfPd(1);
					assetService.updateByPrivateKey(asset);
					tip="盘点成功";
				}else{
					
				}
			}
			assetWeb = passAssetWeb(asset);
			/*if(getSession().getAttribute("tip") != null && getSession().getAttribute("tip") != ""){
				tip=(String) getSession().getAttribute("tip");
				getSession().setAttribute("tip", "");
			};*/
		} catch (Exception e) {
			// TODO: handle exception
			e.printStackTrace();
			return "sysError";
		}
		return SUCCESS;
	}
	
	
	public String getQRcode(){
		try {
			output=getResponse().getOutputStream();
		} catch (IOException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
			return "sysError";
		}
		try {
			QRCodeUtil.encode(text, null, output, true);
			output.flush();  
			output.close();
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return "sysError";
		}
		return null;
	}
	public String exportAssetExcel(){
		List<Asset> assetList=assetService.listAll();
		String excelName="信息表";
		try {
			Workbook wb=getAssetExcel(assetList,excelName);
			OutputStream out = getResponse().getOutputStream();
	        wb.write(out);
	        out.flush();
	        out.close();
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			getSession().setAttribute("tip", "导出Excel失败");
		}
		return null;
	}
	
	private Workbook getAssetExcel(List<Asset> assetList, String excelName) throws Exception{
	      ArrayList<String> listTitle = new ArrayList<String>();//csv 顺序：资产编号，设备类别，设备型号，使用人员，使用部门，使用地点，使用状况，设备来源，资产配置，购买时间，开始使用时间
	      listTitle.add("资产编号");
	      listTitle.add("设备类别");
	      listTitle.add("设备型号");
	      listTitle.add("使用人员");
	      listTitle.add("使用部门");
	      listTitle.add("使用地点");
	      listTitle.add("使用状况");
	      listTitle.add("设备来源");
	      listTitle.add("资产配置");
	      listTitle.add("购买时间");
	      listTitle.add("开始使用时间");
	      listTitle.add("最后修改时间");
	      listTitle.add("备注");
	      Object[] oarr = listTitle.toArray();
	      //HttpServletResponse response = ServletActionContext.getResponse();
	      getResponse().setContentType("application/vnd.ms-excel;charset=UTF-8");
	      if(getRequest().getHeader("User-Agent").toLowerCase().indexOf("firefox") > 0)// firefox浏览器
	         excelName = new String(excelName.getBytes("UTF-8"), "ISO8859-1");
	      else if(getRequest().getHeader("User-Agent").toLowerCase().indexOf("trident") > 0)// IE浏览器，ie11后请求头中的User-Agent中不再有"MSIE"
	         excelName = URLEncoder.encode(excelName, "UTF-8");
	      else if(getRequest().getHeader("User-Agent").toLowerCase().indexOf("chrome") > 0)// google浏览器
	         excelName = new String(excelName.getBytes("UTF-8"), "ISO8859-1");
	      // 转码防止乱码
	      getResponse().addHeader("Content-Disposition", "attachment;filename=" + excelName + ".xls");
	      List<POIExcelBaseBean> listRows = new ArrayList<POIExcelBaseBean>();
	      SimpleDateFormat fd0 = new SimpleDateFormat("yyyy-MM-dd");
	      SimpleDateFormat fd1 = new SimpleDateFormat("yyyy-MM-dd  HH:mm:ss");
	      for(Asset a: assetList){
	          String buyTime = "";
	          String usedTime = "";
	          String lastTime = "";
	          String equipGenre = "";
	          String usePosition = "";
	          String source = "";
	          String status = "";
	          if(a.getBuyTime() != null){
	              buyTime = fd0.format(a.getBuyTime());
	          }
	          if(a.getUsedTime() != null){
	              usedTime = fd0.format(a.getUsedTime());
              }
	          if(a.getModifyTime() != null){
	              lastTime = fd1.format(a.getModifyTime());
	          }
	          if(a.getEquipGenre() != null){
	              equipGenre = Asset.EquipGenre.getName(a.getEquipGenre());
	          }
	          if(a.getUsePosition() != null){
	              usePosition = a.getUsePosition();
	          }
             if(a.getSource() != null){
                 source = Asset.Source.getName(a.getSource());
             }
             if(a.getStatus()!=null){
                 status = Asset.Status.getName(a.getStatus());
             }
	         listRows.add(new POIExcelAssetBean(a.getEquipIdentifier(), equipGenre, a.getEquipModel(), a.getUsePerson(), a.getUseDepart(), usePosition, status, source, a.getAssetAllocation(), buyTime, usedTime ,lastTime ,a.getRemarks()));
	      }
	      return POIExcelUtils.OutputExcel(oarr, listRows, 1, null, null);
	   }
	public String listAssetAll(){
		try{
			/*if(temp!=null && !"".equals(temp)){
				assetLists=assetService.listAssetByKeyAndString(null, temp);
			}else{
				assetLists = assetService.listAll();
			}*/
			//assetLists = listAssetAllPage();
			temp=getTemp();
			if(getSession().getAttribute("tip") != null && getSession().getAttribute("tip")!=""){
				tip=(String) getSession().getAttribute("tip");
				getSession().setAttribute("tip", "");
			};
		}catch(Exception e){
			e.printStackTrace();
			return "sysError";
		}
		
		return "success";
	}
	
	public String listAllAssetData(){
        Status s=statusService.getStatus();
        List<Asset> asl = new ArrayList<Asset>();
        pageNumAll=0; 
        try{
            asl=assetService.listAssetAllPage(temp, start, length, equipGenre, status);
        }catch(Exception e){
            // TODO: handle exception
            e.printStackTrace();
            throw e;
        }
        pageNumAll =assetService.listAssetAllPage(temp, null, null, equipGenre, status).size();
        dataMap = new HashMap<String, Object>();
        dataMap.put("draw", draw);
        dataMap.put("recordsTotal", pageNumAll);
        dataMap.put("data", passArray(asl));
        dataMap.put("recordsFiltered", pageNumAll);
        return "success";
    }

	public String fileInputAsset(){
		if(fileName!=null && !fileName.equals(""))
		{
			System.out.println(fileName);
			return "success";
		}else{
			return "success";
		}		
	}
	
	public String assetInfo(){
		try{
			if(id == 0){
				asset=new Asset();
			}else{
				asset= assetService.getAssetByPrivateKey(id);
			}
			assetWeb = passAssetWeb(asset);
			//asset= assetService.getAssetByPrivateKey(id);
		}catch(Exception e){
			e.printStackTrace();
			return "sysError";
		}
		return "success";
	}
	public String toAddAsset(){
		return assetInfo();
	}
	
	public String addAsset(){
		try{
			asset.setModifyTime(new Date());
			if(asset.getStatus() == null){
				asset.setStatus(Asset.Status.Spare.value);
			}
			assetService.insert(asset);
		}catch(Exception e){
			e.printStackTrace();
			return "sysError";
		}
		return "success";
	}
	
	public String modifyAsset(){
		try{
			asset.setModifyTime(new Date());
			assetService.updateByPrivateKey(asset);
		}catch(Exception e){
			e.printStackTrace();
			return "sysError";
		}
		return "success";
	}
	
	//删除单个
	public String deleteAsset(){
		try{
			assetService.delectByPrivateKey(id);
			getSession().setAttribute("tip", "删除成功");
			operaRes = "1";
		}catch(Exception e){
			e.printStackTrace();
			getSession().setAttribute("tip", "删除失败");
			return "success";
		}
		return "success"; 
	}
	
	//删除多个
	public String deleteAssetMany(){
		try{
			String [] assetId = ids.split(",");
			int result =0;
			int a=assetId.length;
			String b=assetId[0];
			if(assetId.length == 1  &&  "".equals(assetId[0])){
				getSession().setAttribute("tip", "请选择需要删除的信息");
			}else{
				for(String as:assetId){
					result=assetService.delectByPrivateKey(Integer.parseInt(as));				
				}
				if(result!=0){
					operaRes ="1";
					getSession().setAttribute("tip", "删除成功");
				}else{
					operaRes ="2";
					getSession().setAttribute("tip", "删除失败");
				}
			}
		}catch(Exception e){
			e.printStackTrace();
			getSession().setAttribute("tip", "删除失败，系统有错误");
			return "success";
		}
		return "success";
	}
	
	//产生二维码
	public String genQRcode(){
		try{
			QRcodeUrl = new ArrayList<String>();
			if(checkedIds != null){
				for(String as : checkedIds){
					QRcodeUrl.add("/asset/getQRcode.action?text="+url+"?id="+as);
				}	
			}
		}catch(Exception e){
			e.printStackTrace();
		}
		return "success";
	}
	public String assignAsset(){
		Asset asset = assetService.getAssetByPrivateKey(id);
		User user = userService.getUserById(userId);
		asset.setUsePerson(user.getName());
		asset.setStatus(Asset.Status.Assigned.value);
		asset.setModifyTime(new Date());
		assetService.updateByPrivateKey(asset);
//		asset.setUsePerson();
		return SUCCESS;
	}
	public String listUserData(){
		List<User> userData = userService.listUser(queryUserName,null,null);
		jsonArray = new JSONArray();
		for(User u:userData){
			JSONObject userObj = new JSONObject();
			userObj.put("id",u.getId());
			userObj.put("text",u.getName());
			jsonArray.add(userObj);
		}
		return SUCCESS;
	}

	public String getText() {
		return text;
	}
	public void setText(String text) {
		this.text = text;
	}
	public OutputStream getOutput() {
		return output;
	}
	public void setOutput(OutputStream output) {
		this.output = output;
	}


	public File getFile() {
		return file;
	}


	public void setFile(File file) {
		this.file = file;
	}


	public String getFileName() {
		return fileName;
	}


	public void setFileName(String fileName) {
		this.fileName = fileName;
	}


	public List<Asset> getAssetLists() {
		return assetLists;
	}


	public void setAssetLists(List<Asset> assetLists) {
		this.assetLists = assetLists;
	}


	public Asset getAsset() {
		return asset;
	}


	public void setAsset(Asset asset) {
		this.asset = asset;
	}


	public int getId() {
		return id;
	}


	public void setId(int id) {
		this.id = id;
	}


	public String getIds() {
		return ids;
	}


	public void setIds(String ids) {
		this.ids = ids;
	}


	public String getOperaRes() {
		return operaRes;
	}


	public void setOperaRes(String operaRes) {
		this.operaRes = operaRes;
	}


	public String[] getCheckedIds() {
		return checkedIds;
	}


	public void setCheckedIds(String[] checkedIds) {
		this.checkedIds = checkedIds;
	}


	public List<String> getQRcodeUrl() {
		return QRcodeUrl;
	}


	public void setQRcodeUrl(List<String> qRcodeUrl) {
		QRcodeUrl = qRcodeUrl;
	}


	public String getTemp() {
		return temp;
	}


	public void setTemp(String temp) {
		this.temp = temp;
	}
	public List<Asset> getPdLists() {
		return pdLists;
	}
	public void setPdLists(List<Asset> pdLists) {
		this.pdLists = pdLists;
	}
	public List<Asset> getUnPdLists() {
		return unPdLists;
	}
	public void setUnPdLists(List<Asset> unPdLists) {
		this.unPdLists = unPdLists;
	}
	public int getPdStatus() {
		return pdStatus;
	}
	public void setPdStatus(int pdStatus) {
		this.pdStatus = pdStatus;
	}
	public int getPageSizeALL() {
		return pageSizeALL;
	}
	public void setPageSizeALL(int pageSizeALL) {
		this.pageSizeALL = pageSizeALL;
	}
	public int getPageSizeCurr() {
		return pageSizeCurr;
	}
	public void setPageSizeCurr(int pageSizeCurr) {
		this.pageSizeCurr = pageSizeCurr;
	}
	public int getPageNumAll() {
		return pageNumAll;
	}
	public void setPageNumAll(int pageNumAll) {
		this.pageNumAll = pageNumAll;
	}
	
	public int getQuerySum() {
		return querySum;
	}
	public void setQuerySum(int querySum) {
		this.querySum = querySum;
	}
	public static int getPigeNum() {
		return pigeNum;
	}
	public static void setPigeNum(int pigeNum) {
		AssetAction.pigeNum = pigeNum;
	}
	public List<Integer> getPagingArr() {
		return pagingArr;
	}
	public void setPagingArr(List<Integer> pagingArr) {
		this.pagingArr = pagingArr;
	}
    public Integer getStart(){
        return start;
    }
    public void setStart(Integer start){
        this.start = start;
    }
    public Integer getLength(){
        return length;
    }
    public void setLength(Integer length){
        this.length = length;
    }
    public Integer getDraw(){
        return draw;
    }
    public void setDraw(Integer draw){
        this.draw = draw;
    }
    public Map<String, Object> getDataMap(){
        return dataMap;
    }
    public void setDataMap(Map<String, Object> dataMap){
        this.dataMap = dataMap;
    }
    public AssetWeb getAssetWeb(){
        return assetWeb;
    }
    public void setAssetWeb(AssetWeb assetWeb){
        this.assetWeb = assetWeb;
    }
    public Short getEquipGenre(){
        return equipGenre;
    }
    public void setEquipGenre(Short equipGenre){
        this.equipGenre = equipGenre;
    }
    public Short getStatus(){
        return status;
    }
    public void setStatus(Short status){
        this.status = status;
    }

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public String getQueryUserName() {
		return queryUserName;
	}

	public void setQueryUserName(String queryUserName) {
		this.queryUserName = queryUserName;
	}

	public List<User> getUserList() {
		return userList;
	}

	public void setUserList(List<User> userList) {
		this.userList = userList;
	}

	public JSONArray getJsonArray() {
		return jsonArray;
	}

	public void setJsonArray(JSONArray jsonArray) {
		this.jsonArray = jsonArray;
	}

	public JSONObject getJsonObject() {
		return jsonObject;
	}

	public void setJsonObject(JSONObject jsonObject) {
		this.jsonObject = jsonObject;
	}

	public Long getUserId() {
		return userId;
	}

	public void setUserId(Long userId) {
		this.userId = userId;
	}
}
